#pragma once
#ifndef PLAYER_H
#define PLAYER_H

#include <Entity.h>
#include <EntityManager.h>
#include <AnimationPlayer.h>
// Entity interations
#include <Collision.h>
#include <Contact.h>
// Physics
#include <Particle.h>
#include <ForceGenerator.h>
#include <ForceRegistry.h>
// Forces


class Player : public Entity
{
private:
	AnimationPlayer* anims;
	Particle particle;
	bool flip;
public:
	Player(AnimationPlayer* playerAnims, D3DXVECTOR3 startPos)
		: Entity(startPos, 0, "Player"),
		anims(playerAnims),
		particle(startPos, D3DXVECTOR3(0,0,0), 10.0f)
	{
		flip = false;
		// Set the current animation
		anims->playAnimation("Idle");
// IMPORTANT Every entity requires a single frame texture to avoid 
		// runtime errors so make
		setTexture(anims->getCurrentAnimation()->getTexture());
	}
	~Player() { delete anims; }
	void update(float frameTime);
	void draw(ID3DXSprite* sprite);
	void handleMessage(Message message);

	D3DXVECTOR3 getPosition() { return particle.position; }
	virtual void setPosition(D3DXVECTOR3 newPosition)
	{ 
		position = newPosition; 
		particle.position = newPosition;
	}
	IDirect3DTexture9* getTexture()
	{
		return texture;
	}
};

#endif // PLAYER_H